//
//  XJComposeBtn.m
//  weiboOC
//
//  Created by 徐绩 on 16/5/2.
//  Copyright © 2016年 ayumi. All rights reserved.
//

#import "XJComposeBtn.h"
#import "XJComposeMenuItemsModel.h"

@implementation XJComposeBtn

-(void)setHighlighted:(BOOL)highlighted{}

-(void)setModel:(XJComposeMenuItemsModel *)model{
    
    _model = model;
    
    [self setTitle:self.model.title forState:UIControlStateNormal];
    [self setImage:[UIImage imageNamed:model.icon] forState:UIControlStateNormal];
    
}

-(instancetype)initWithFrame:(CGRect)frame{

    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

-(void)setupUI{

    self.titleLabel.font = [UIFont systemFontOfSize:14];
    [self setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    
    self.imageView.contentMode = UIViewContentModeCenter;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
}

-(void)layoutSubviews{

    [super layoutSubviews];
    
    self.imageView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.width);
    self.titleLabel.frame = CGRectMake(0, self.frame.size.width, self.frame.size.width, self.frame.size.height - self.frame.size.width);
}

@end
